﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace SourceBackup
{
    public class SourceBackupFile
    {
        [System.Xml.Serialization.XmlAttribute, Description("Root directory of solution")]
        public string SolutionFolder = string.Empty;

        [System.Xml.Serialization.XmlAttribute, Description("Name and path of backup output file")]
        public string ZipFilePath = string.Empty;

        [System.Xml.Serialization.XmlAttribute, Description("File filter name")]
        public string FilterName = string.Empty;

        [System.Xml.Serialization.XmlAttribute, Description("Append date")]
        public bool AppendDate = false;

        [System.Xml.Serialization.XmlAttribute, Description("Show ignored files")]
        public bool ShowIgnoredFiles = false;

        [System.Xml.Serialization.XmlAttribute, Description("Show bin and obj directories")]
        public bool IgnoreBinObj = false;

        [System.Xml.Serialization.XmlAttribute, Description("Post backup action (none, copy or move)")]
        public string PostBackupAction = "none";

        internal static SourceBackupFile LoadFromFile(string filePath)
        {
            return SerializationUtils.DeserializeXMLFile<SourceBackupFile>(filePath);
        }
        internal void SaveToFile(string filePath)
        {
            System.IO.File.WriteAllText(filePath, SerializationUtils.SerializeToXML<SourceBackupFile>(this));
        }
    }
}
